#pragma warning disable 0618
using System;
using System.Collections.Generic;
using Table.DataModel;
namespace Table.Dao
{
    public class TablePlotEpisodeStepDao:DaoBase<TablePlotEpisodeStep>
    {
        public override string GetFileName()
        {
            return "TablePlotEpisodeStep.csv";
        }
        public override void BuildIndex()
        {
            if (cacheList != null)
            {
                cachePrimaryInt = new Dictionary<int, TablePlotEpisodeStep>(cacheList.Count);
            }
            base.BuildIndex();
        }
        public override void AddOneIndex(TablePlotEpisodeStep model)
        {
            if (!cacheOneIndex.ContainsKey(model.PlotEpsiodeId.ToString()))
            {
                cacheOneIndex[model.PlotEpsiodeId.ToString()] = new List<TablePlotEpisodeStep>();
            }
            cacheOneIndex[model.PlotEpsiodeId.ToString()].Add(model);
        }
        public override void AddPrimaryIndex(TablePlotEpisodeStep model)
        {
            #if UNITY_EDITOR
            if(cachePrimaryInt.ContainsKey(model.PlotEpisodeStepId)) UnityEngine.Debug.LogError("数据表id重复:TablePlotEpisodeStep->id: " + model.PlotEpisodeStepId);
            #endif
            cachePrimaryInt[model.PlotEpisodeStepId] = model;
        }
        protected override TablePlotEpisodeStep ParseRowData(string[] rowData)
        {
            TablePlotEpisodeStep data = new TablePlotEpisodeStep();
            if (!string.IsNullOrEmpty(rowData[0]))
            {
                data.PlotEpisodeStepId = int.Parse(rowData[0]);
            }
            if (!string.IsNullOrEmpty(rowData[1]))
            {
                data.PlotEpsiodeId = int.Parse(rowData[1]);
            }
            if (!string.IsNullOrEmpty(rowData[2]))
            {
                data.Step = int.Parse(rowData[2]);
            }
            if (!string.IsNullOrEmpty(rowData[3]))
            {
                data.TalkerName = string.Intern(rowData[3]);
            }
            if (!string.IsNullOrEmpty(rowData[4]))
            {
                data.TalkerPortrait = rowData[4];
            }
            if (!string.IsNullOrEmpty(rowData[5]))
            {
                data.TalkerPos = int.Parse(rowData[5]);
            }
            if (!string.IsNullOrEmpty(rowData[6]))
            {
                data.CameraType = int.Parse(rowData[6]);
            }
            if (!string.IsNullOrEmpty(rowData[7]))
            {
                data.Content = rowData[7];
            }
            if (!string.IsNullOrEmpty(rowData[8]))
            {
                data.Duration = float.Parse(rowData[8]);
            }
            return data;
        }
    }
}
